﻿using Mengsk.ProxyDelivery.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace Mengsk.ProxyDelivery.Converters
{
    public class OrderErrorCodeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Enum en = (Enum)value;
            string[] ss = EnumUtil.GetEnumValueDescriptions(en).Where(obj => obj.Equals("所有") == false && obj.Equals("正常") == false).ToArray();
            string s = parameter as string;
            if (string.IsNullOrWhiteSpace(s))
            {
                s = ",";
            }
            if ("\\n".Equals(s))
            {
                s = "&#10;";
            }
            return string.Join(s, ss);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
